function results=find_LFMcells(ExpGroup)
fig_pos=[25   477   612   327];

% [xls_num,xls_txt]=xlsread('\\argon.fmi.ch\keller.g\ExpLog\Stacks.xlsx');
%
% expIDs=[];
% cnt=1;
% for ynd=1:size(xls_num,1)
%     if ~isempty(strfind(xls_txt{ynd+1,4},mouse))
%         expIDs(ynd)=xls_num(ynd,2);
%     end
% end
% expIDs(expIDs==0)=[];
% expIDs=unique(expIDs);
% ExpGroup=expIDs;
tmp_data_dir = '\\KELLER-RIG1-ANA\RawData\';
adata_dir = '\\argon.fmi.ch\keller.g\AData\';
cnt2=1;
tcnt=1;
for fnd=1:length(ExpGroup)
    display(['Exp: ' num2str(ExpGroup(fnd)) ' *****************************']);
    [adata_file,mouse_id,userID]=find_adata_file(ExpGroup(fnd),adata_dir);
    matobj=matfile([adata_dir '\' userID '\' mouse_id '\' adata_file]);
    if iscell(matobj.bv)
        tempmat=matobj.ROIs(1,1);
        if size(tempmat{1},2)==1
            use_rois=0;
        elseif isfield(tempmat{1}(1),'activity')
            use_rois=1;
        else
            use_rois=0;
        end
    else
        if size(matobj.ROIs,2)==1
            use_rois=0;
        elseif isfield(matobj.ROIs(1,1),'activity')
            use_rois=0;
        else
            use_rois=1;
        end
    end
    if use_rois
        orig=load([adata_dir userID '\' mouse_id '\' adata_file],'ROIs','nbr_frames','aux_files');
        aux_data=[];
        try
            for ind=1:length(orig.aux_files)
                if exist([tmp_data_dir userID '\' mouse_id '\' orig.aux_files{ind}],'file');
                    %                     disp(['loading file ' orig.aux_files{ind} ' from local tmpdata directory']);
                    curr_load_path=[tmp_data_dir userID '\' mouse_id '\' orig.aux_files{ind}];
                else
                    %                     disp(['loading file ' orig.aux_files{ind} ' from the network RawData directory']);
                    curr_load_path=[rdata_dir userID '\' mouse_id '\' orig.aux_files{ind}];
                end
                tmp_data=load_lvd(curr_load_path);
                tmp_frames=get_frame_times(tmp_data(2,:));
                
                if orig.nbr_frames(ind)~=length(tmp_frames)
                    if max(diff(tmp_frames))/median(diff(tmp_frames))<1.5 & length(tmp_frames)>orig.nbr_frames(ind)
                        %                         disp('NC WARNING! Probably scanning too fast for FPGA to stop in the same frame')
                        %                         disp(['--- ' num2str(length(tmp_frames)-orig.nbr_frames(ind)) ' frames too many ---'])
                        tmp_data(2,tmp_frames(orig.nbr_frames(ind)+1):end)=0;
                    else
                        %                         disp('CRITICAL WARNING! - aux data longer than it should be.')
                        %return
                        %tmp_data=tmp_data(:,1:tmp_frames(nbr_frames(ind)+1));
                        [~,last_bad_frame]=max(diff(tmp_frames));
                        tmp_data=tmp_data(:,ceil(mean([tmp_frames(last_bad_frame) tmp_frames(last_bad_frame+1)])):end);
                    end
                end
                aux_data(:,end+1:end+length(tmp_data))=tmp_data;
            end
            
            frame_times=get_frame_times(aux_data(2,:));
            
            %         vars_to_assigin_base={vars_to_assigin_base{:}, 'aux_data', 'frame_times'};
        catch
            disp('Did not load aux data')
        end
        for pnd=1:length(orig.ROIs)
            for xnd=1:length(orig.ROIs{pnd})
                [fb_snips_av,pb_snips_av,~,~,thresh_arr{tcnt}]=pert_ana_new2(aux_data,frame_times,orig.ROIs,orig.nbr_frames,0,0,0,xnd,pnd);
                tcnt=tcnt+1;
                found_it=0;
                if ~isempty(fb_snips_av{13})&~isempty(pb_snips_av{13})
                    quit_exp=0;
                    found_it=det_LFM_resp(fb_snips_av,pb_snips_av);
                else
                    quit_exp=1;
                end
                if quit_exp
                    break
                end
                if found_it
                    display(['************************************************'])
                    display(['cell ' num2str(xnd) ' layer: ' num2str(pnd)])
                    curYmax=0;
                    for ond=1:length(fb_snips_av);
                        if isempty(fb_snips_av{ond})
                            snipy(ond)=0;
                        else
                            snipy(ond)=max([max(fb_snips_av{ond}) max(pb_snips_av{ond})]);
                        end
                    end
                    curYmax=max([curYmax max(snipy) 2]);
                    curYmax=curYmax+0.1;
                    
                    %                     for znd=1:length(fb_snips_av);
                    %                         if isempty(fb_snips_av{znd})
                    %                             snipy2(znd)=0;
                    %                         else
                    %                             snipy2(znd)=min([min(fb_snips_av{znd}) min(pb_snips_av{znd})]);
                    %                         end
                    %                     end
                    %                     snipy2(snipy2==0)=[];
                    %                     curYmin=min(snipy2);
                    
                    sequ=[1 2 3 8 9 10 4 5 6 11 12 13 7];
                    figure;%('color',[1 1 1]);
                    set(gcf,'position',fig_pos);
                    for cnd=1:length(fb_snips_av)
                        subplot(2,7,sequ(cnd))
                        if cnd==1
                            title(['cell ' num2str(xnd) ' z: ' num2str(pnd)])
                        end
                        rectangle('position',[1500 0 1000 4],'facecolor',[0.95 0.95 0.95],'linestyle','none')
                        if ~isempty(fb_snips_av{cnd})
                            hold on
                            plot(fb_snips_av{cnd},'color',[1 0 0],'LineWidth',2)
                        end
                        if ~isempty(pb_snips_av{cnd})
                            hold on
                            plot(pb_snips_av{cnd},'color',[0 0 0],'LineWidth',2)
                        end
                        axis tight
                        axis off
                        box off
                        ylim([0 curYmax])
                        xlim([0 4001])
                        drawnow
                    end
                    ag = findobj; % all graphical objects
                    nf = max(ag(find(ag==fix(ag)))); % maximal integer value is number of figures
                    display(['figure: ' num2str(nf)])
                    display(['************************************************'])
                    results{cnt2}=[mouse_id ' ' num2str(ExpGroup(fnd)) ' cell ' num2str(xnd) ' layer: ' num2str(pnd) ' figure: ' num2str(nf)];
                    cnt2=cnt2+1;
                end
            end
            if quit_exp
                break
            end
        end
    end
end
res_fpath='C:\Data\zmarpawe\algo_res';
files=dir(res_fpath);
old_name=files(end).name;
old_num=str2num(old_name(findstr(old_name,'_')+1:findstr(old_name,'.')-1));
old_num=old_num+1;
new_name=['LFMres_' num2str(old_num) '.txt'];
fid=fopen([res_fpath '\' new_name],'w');
fprintf(fid,'%s\r\n',results{1,:});
fclose(fid);